package com.platform.hjt.base.log;

/**
 * 切面枚举类
 * @author 吴智超
 * 2016-09-27
 */
public enum AopEnum {

	BEFORT("前置通知", AopConstant.BEFORE), AFTER("后置通知", AopConstant.AFTER), AROUND("环绕通知", AopConstant.AROUND), 
	AFTER_RETURN("返回后通知", AopConstant.AFTER_RETURN), AFTER_THROW("抛出异常后通知", AopConstant.AFTER_TRHOW);
	
	private String name;
	private int code;
	private AopEnum(String name, int code){
		this.name = name;
		this.code = code;
	}
	
	public String getName() {
		return name;
	}
	public int getCode() {
		return code;
	}
	
	/**
	 * 通过代码获取枚举值说明
	 * @param code
	 * @return
	 */
	public static String getNameByCode(int code){
		AopEnum[] aopEnums = AopEnum.values();
		for(AopEnum aopEnum : aopEnums){
			if(code == aopEnum.getCode()){
				return aopEnum.getName();
			}
		}
		return null;
	}
}
